<?php //pack11class

class ObjectCardBody extends Module {

    public $traceEnabled=true;

    public function setup() {
        if(get_class($this->param)=="DekaroObject") {
            $object=$this->param;
        } else {
            return false;
        }
        $this->setID("ObjectCardBody");
        $this->addChild(new ObjectCardList($object));
        $this->addChild(new ObjectCardMap($object));

        $images=$object->getPhotos();
        $counter=0;
        usort($images, array("AdminObject","sortPhotos"));
        foreach($images as $image) {
            $item=new ObjectCardImage($image->value);
            $item->setID("ObjectCardImage".$counter);
            if($counter==0) {
                $item->addNavigation(ObjectCardImageNavigationButton::NEXT);
            } else if($counter==count($images)-1) {
                $item->addNavigation(ObjectCardImageNavigationButton::PREVIOUS);
            } else {
                $item->addNavigation(ObjectCardImageNavigationButton::BOTH);
            }
            $this->addChild($item);
            $counter++;
        }
    }

}
?>
